import request from '@/config/axios'
import type { Country } from './types'

export const getCountriesListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/countries', params })
}

export const createCountriesApi = (data: Partial<Country>): Promise<IResponse> => {
  return request.post({ url: '/countries', data })
}

export const updateCountriesApi = (id: string, data: Partial<Country>): Promise<IResponse> => {
  return request.put({ url: `/countries/id/${id}`, data })
}

export const getCountriesDetailApi = (id: string): Promise<IResponse<Country>> => {
  return request.get({ url: `/countries/id/${id}` })
}

export const delCountriesListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/countries/id/${ids[0]}` })
}
